package org.jeecg.modules.iot.bind.mapper;

import java.time.LocalDateTime;

import org.apache.ibatis.annotations.*;
import org.jeecg.modules.iot.bind.entity.YlBindToken;
import org.jeecg.modules.iot.bind.entity.YlBindUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 设备绑定操作员表
 * @Author: jeecg-boot
 * @Date:   2024-09-03
 * @Version: V1.0
 */
public interface YlBindUserMapper extends BaseMapper<YlBindUser> {


    /*********************************绑定设备用户token相关操作*****************************************************************************************/
    @Insert("insert into yl_bind_token(id,user_id,token,expire_time,update_time) values (#{id},#{userId},#{token},#{expireTime},now())")
    void addToken(String id, String userId, String token, LocalDateTime expireTime);
    @Update("update yl_bind_token set token = #{token},expire_time = #{expireTime},update_time = now() where user_id = #{userId}")
    void updateToken();
    @Delete("delete from yl_bind_token where token = #{token}")
    void delToken(String token);
    @Delete("delete from yl_bind_token where user_id = #{userId}")
    void delGasTokenByUserId(String userId);
    @Select("select * from yl_bind_token where token = #{token}")
    YlBindToken getUserIdByToken(String token);
    /*********************************绑定设备用户token相关操作*****************************************************************************************/

}
